package cn.iocoder.yudao.module.promotion.dal.mysql.prizedraw;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.prizedraw.vo.PrizeDrawAwardsPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.prizedraw.PrizeDrawAwardsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 抽奖活动奖品 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PrizeDrawAwardsMapper extends BaseMapperX<PrizeDrawAwardsDO> {

    default PageResult<PrizeDrawAwardsDO> selectPage(PrizeDrawAwardsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PrizeDrawAwardsDO>()
                .eqIfPresent(PrizeDrawAwardsDO::getPrizeDrawId, reqVO.getPrizeDrawId())
                .likeIfPresent(PrizeDrawAwardsDO::getAwardName, reqVO.getAwardName())
                .eqIfPresent(PrizeDrawAwardsDO::getDrawType, reqVO.getDrawType())
                .eqIfPresent(PrizeDrawAwardsDO::getDrawSort, reqVO.getDrawSort())
                .eqIfPresent(PrizeDrawAwardsDO::getAwardType, reqVO.getAwardType())
                .eqIfPresent(PrizeDrawAwardsDO::getPoint, reqVO.getPoint())
                .eqIfPresent(PrizeDrawAwardsDO::getTemplateId, reqVO.getTemplateId())
                .eqIfPresent(PrizeDrawAwardsDO::getSpuId, reqVO.getSpuId())
                .likeIfPresent(PrizeDrawAwardsDO::getSpuName, reqVO.getSpuName())
                .eqIfPresent(PrizeDrawAwardsDO::getSkuId, reqVO.getSkuId())
                .likeIfPresent(PrizeDrawAwardsDO::getPrizeName, reqVO.getPrizeName())
                .eqIfPresent(PrizeDrawAwardsDO::getPrizePic, reqVO.getPrizePic())
                .eqIfPresent(PrizeDrawAwardsDO::getPrizeNums, reqVO.getPrizeNums())
                .eqIfPresent(PrizeDrawAwardsDO::getPrizeChance, reqVO.getPrizeChance())
                .eqIfPresent(PrizeDrawAwardsDO::getTodayPrizeNums, reqVO.getTodayPrizeNums())
                .eqIfPresent(PrizeDrawAwardsDO::getTodaySurplusNums, reqVO.getTodaySurplusNums())
                .betweenIfPresent(PrizeDrawAwardsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PrizeDrawAwardsDO::getPrizeDrawAwardsId));
    }

}